class CreateBooks < ActiveRecord::Migration
  def self.up
    create_table :books do |t|
      t.string :title, :null => false,:limit => 500
      t.string :author, :null => false
      t.string :version, :null => false
      t.string :publisher,:limit =>500
      t.string :year, :limit => 4
      t.string :barcode, :null => false, :limit => 12
      t.string :category, :null => false,:limit => 20
      t.float :rate, :default => 0
      t.integer :rate_number, :default => 0
      t.integer :quantity,  :default => 0
      t.text :description
      t.string :image_file_name
      t.string :image_content_type
      t.integer :image_file_size
      t.datetime  :image_updated_at
      t.timestamps
    end
  end
  def self.down
    drop_table :books
  end
end
